<template>
	<view>
		<loading v-if="0 != loading" :status="loading" />
		<view v-else class="body">
			<view>
				<!-- 空购物车 -->
				<view v-if="!msgHidden">
					<view class="msg">
						<view class="icon iconfont icon-ysgouwuche1"></view>
						<view>购物车是空的~</view>
					</view>
					<!-- 商品推荐 --> 
					<goodsRecommendation v-if="1 == platformConfig.likeSwitch" ref="goodsRecommendation" title="您可能还喜欢"
						from="trolley" />
				</view>
				<!-- 购物车 -->
				<view class="stores" v-if="!storeHidden">
					<view class="store-item" v-for="(store, storeIndex) in trolleyGoods" :key="store.id">
						<view class="store-header">
							<view class="store-Info">
								<text
									:class="'icon iconfont ' + (store.isAllChose ? 'icon-ok' : 'icon-null') + ' store-chioce'"
									:data-store-index="storeIndex" :data-indexx="storeIndex"
									:style="'color:' + (store.isAllChose ? platformConfig.baseColor : '#ccc')"
									@tap="chooseStore"></text>
								<!-- <navigator :url="'/subPackages/minorPkg/pages/store/store?merchantId=' + store.id">
									<text class="store-name">{{ store.name }}</text>
									<text class="icon iconfont icon-iconfontyoujiantou"></text>
								</navigator> -->
							</view>
							<text class="get-coupon-btn" :data-stroeid="store.id" @tap="getCouponsList">领券</text>
						</view>

						<view class="store-goods">
							<view :class="'goods-item ' + (goods.isTouchMove ? 'touch-move-active' : '')"
								v-for="(goods, goodsIndex) in store.goods" :key="goods.id">
								<view class="goods" :data-index="goodsIndex" :data-store-index="storeIndex"
									@touchstart="touchstart" @touchmove="touchmove">
									<text
										:class="'icon iconfont ' + (goods.isChose ? 'icon-ok' : 'icon-null') + ' goods-chioce'"
										:data-goods-index="goodsIndex" :data-store-index="storeIndex"
										:data-indexx="storeIndex" :data-indexy="goodsIndex" :data-good-id="goods.id"
										@tap="chooseGoods"
										:style="'color:' + (goods.isChose ? platformConfig.baseColor : '#ccc')"></text>
									<view class="goods-content">
										<view class="goods-logo" :data-goodsId="goods.goodsId" @tap="checkGoodsOn">
											<image class="goods-image" :src="baseUrl + '/' + goods.img"></image>
											<!-- <view class='vip-block' wx:if='{{"1" == goods.joinMbrDiscount && store.discount != undefined}}'>
                    <view class='vip-prices'>
                    <view style="margin-top:0.1rem">
                      <template is="money" data="{{money:goods.price * store.discount / 100}}"></template>
                      </view>
                      <view class='vip-jias'>
                        会员价
                      </view>
                    </view>
                  </view> -->
										</view>
										<view class="right">
											<view class="goods-name" :data-goodsId="goods.goodsId"
												@tap.stop.prevent="checkGoodsOn">
												<view class="name">{{ goods.name }}</view>
												<view class="goods-spec" :data-id="goods.id"
													:data-goodsId="goods.goodsId" :data-goods-index="goodsIndex"
													:data-store-index="storeIndex" :data-indexx="storeIndex"
													:data-indexy="goodsIndex" @tap.stop.prevent="loadGoodsInfo"
													:style="'display:' + (util.isEmpty(goods.spec) || goods.spec == ' ' ? 'none' : 'inline-block')">
													<text class="spec">{{ util.clearSpec(goods.spec) }}</text>
													<text class="iconfont icon-right1"></text>
												</view>
											</view>
											<view class="right-bottom">
												<view class="p-price">
													<view class="goods-price"
														:style="'color:' + platformConfig.baseColor">
														<!-- <template is="money" data="{{money:goods.price,fontSize:36}}"></template> -->
														<!-- <template wx:if='{{"1" == goods.joinMbrDiscount && store.discount != undefined}}' is="money" data="{{money:goods.price * store.discount/100,fontSize:36}}"></template> -->
														<!-- <template wx:if='{{"1" == goods.joinMbrDiscount && store.discount == undefined}}' is="money" data="{{money:goods.price,fontSize:36}}"></template> -->
														<!-- <text class='discount-title' wx:if='{{"1" == goods.joinMbrDiscount && store.discount != undefined}}'>(vip)</text> -->
														<!-- <template wx:if='{{"1" != goods.joinMbrDiscount}}' is="money" data="{{money:goods.price,fontSize:36}}"></template> -->
														<!-- parse <template v-if="goods.showVipDiscount" is="money" :data="money:goods.vipPrice,fontSize:36"></template> -->
														<block v-if="goods.showVipDiscount" name="money">
															<view
																style="display: flex; align-items: baseline; line-height: 1"
																class="num">
																<text :style="'font-size:' + 30 * 0.7 + 'rpx;'">¥</text>
																<text
																	:style="'font-size:' + 30 + 'rpx;'">{{ util.integerMoney(goods.vipPrice) }}</text>
																<text
																	:style="'font-size:' + 30 * 0.7 + 'rpx;'">{{ util.decimalMoney(goods.vipPrice) }}</text>
															</view>
														</block>
														<!-- parse <template v-else is="money" :data="money:goods.price,fontSize:36"></template> -->
														<block v-else name="money">
															<view
																style="display: flex; align-items: baseline; line-height: 1"
																class="num">
																<text :style="'font-size:' + 30 * 0.7 + 'rpx;'">¥</text>
																<text
																	:style="'font-size:' + 30 + 'rpx;'">{{ util.integerMoney(goods.price) }}</text>
																<text
																	:style="'font-size:' + 30 * 0.7 + 'rpx;'">{{ util.decimalMoney(goods.price) }}</text>
															</view>
														</block>
														<image class="vip_icon" v-if="goods.showVipDiscount"
															src="/static/image/icon_vip.png"></image>
													</view>
												</view>
												<view class="goods-number">
													<text class="decodeadd" :data-goods-index="goodsIndex"
														:data-store-index="storeIndex" @tap="minusTrolley">-</text>
													<input type="number" class="goods-number-num" :value="goods.number"
														:data-skurest="goods.skuRest" :data-goods-index="goodsIndex"
														:data-store-index="storeIndex" @input="isEqualZero"
														@blur="changeTrolley" />
													<text v-if="!goods.cannotBtn" class="decodeadd" :data-goods-index="goodsIndex"
														:data-store-index="storeIndex" @tap="plusTrolley">+</text>
													<text v-else class="decodeadd canNotAdd" @tap="">+</text>
												</view>
											</view>
										</view>
									</view>
								</view>

								<view class="del" @tap.stop.prevent="deleteTrolley" :data-delete-id="goods.id">
									<text class="iconfont icon-delete"></text>
									<text>删除</text>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			
			<!-- 合计 -->
			<view class="calculate footer" v-if="!storeHidden">
				<view style="display: flex; align-items: center; width: 270rpx">
					<text :class="'icon iconfont ' + (allChose ? 'icon-ok' : 'icon-null') + ' store-chioce'"
						:style="'color:' + (allChose ? platformConfig.baseColor : '#ccc')" @tap="chooseAll"></text>
					<text>全选</text>
					<text style="color: #999; width: 96rpx; text-align: center; font-size: 26rpx"
						@tap="deleteTrolleys">删除</text>
				</view>
				<view style="display: flex; align-items: center; padding-right: 44rpx">
					<view
						style="height: 100rpx; display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 10rpx 0">
						<view style="height: 60rpx; display: flex; align-items: flex-end">
							<text>合计:</text>
							<view class="calculate-money" :style="'color:' + platformConfig.baseColor + ';'">
								<!-- parse <template is="money" :data="money:totalMoney,fontSize:36"></template> -->
								<block name="money">
									<view style="display: flex; align-items: baseline; line-height: 1" class="num">
										<text :style="'font-size:' + 30 * 0.7 + 'rpx;'">¥</text>
										<text
											:style="'font-size:' + 30 + 'rpx;'">{{ util.integerMoney(totalMoney) }}</text>
										<text
											:style="'font-size:' + 30 * 0.7 + 'rpx;'">{{ util.decimalMoney(totalMoney) }}</text>
									</view>
								</block>
							</view>
						</view>
						<text
							style="font-size: 24rpx; color: #999; text-align: right; margin-top: 10rpx; padding-right: 20rpx; line-height: 34rpx">不含运费</text>
					</view>
					<text class="calculate-order" :style="'background:' + platformConfig.baseColor + ';'"
						@tap="toAccount" v-if="choosedStore.choosedGoods.length > 0 && !cannotBtn">结算</text>
					<text class="calculate-order" style="background: #ccc"
						v-if="choosedStore.choosedGoods <= 0 || cannotBtn">结算</text>
				</view>
			</view>
		</view>

		<!-- 弹框阴影背景 -->
		<view class="shadow-bg" v-if="specInfoShow" @touchmove.stop.prevent="preventTouchMove">
			<view style="flex-grow: 1" @tap.stop.prevent="closeSpecInfo"></view>
			<!-- 商品规格信息 -->
			<view :class="'spec-info ' + (specInfoShow ? 'slideUp' : '')" v-if="specInfoShow">
				<view class="spec-header">
					<view class="spec-line"></view>
				</view>
				<scroll-view scroll-y style="width: 100%; height: 760rpx">
					<!-- 商品信息 -->
					<view class="spec-goods">
						<image class="spec-goods-img"
							:src="baseUrl + '/' + (goodsDetailInfo != null && !util.isEmpty(goodsDetailInfo.skuImage) ? goodsDetailInfo.skuImage : goodsInfo.images)">
						</image>
						<view class="spec-goods-info">
							<view class="spec-goods-price" :style="'color:' + platformConfig.baseColor + ';'">
								<!-- <template is='money' data='{{money:(goodsDetailInfo!=null)?goodsDetailInfo.salePrice:goodsInfo.price,fontSize:32}}'></template> -->
								<!-- parse <template v-if="goodsDetailInfo.showVipDiscount || goodsInfo.showVipDiscount" is="money" :data="money:(goodsDetailInfo!=null)?goodsDetailInfo.vipDiscountPrice:goodsInfo.vipDiscountPrice,fontSize:36"></template> -->
								<block v-if="goodsDetailInfo.showVipDiscount || goodsInfo.showVipDiscount" name="money">
									<view style="display: flex; align-items: baseline; line-height: 1" class="num">
										<text :style="'font-size:' + 30 * 0.7 + 'rpx;'">¥</text>
										<text
											:style="'font-size:' + 30 + 'rpx;'">{{ util.integerMoney((goodsDetailInfo!=null)?goodsDetailInfo.vipDiscountPrice:goodsInfo.vipDiscountPrice) }}</text>
										<text
											:style="'font-size:' + 30 * 0.7 + 'rpx;'">{{ util.decimalMoney((goodsDetailInfo!=null)?goodsDetailInfo.vipDiscountPrice:goodsInfo.vipDiscountPrice) }}</text>
									</view>
								</block>
								<!-- parse <template v-else is="money" :data="money:(goodsDetailInfo!=null)?goodsDetailInfo.price:goodsInfo.price,fontSize:36"></template> -->
								<block v-else name="money">
									<view style="display: flex; align-items: baseline; line-height: 1" class="num">
										<text :style="'font-size:' + 30 * 0.7 + 'rpx;'">¥</text>
										<text
											:style="'font-size:' + 30 + 'rpx;'">{{ util.integerMoney((goodsDetailInfo!=null)?goodsDetailInfo.price:goodsInfo.price) }}</text>
										<text
											:style="'font-size:' + 30 * 0.7 + 'rpx;'">{{ util.decimalMoney((goodsDetailInfo!=null)?goodsDetailInfo.price:goodsInfo.price) }}</text>
									</view>
								</block>
								<image class="vip_icon"
									v-if="goodsDetailInfo.showVipDiscount || goodsInfo.showVipDiscount"
									src="/static/image/icon_vip.png"></image>
							</view>
							<!-- <text class='spec-vip-price' wx:if='{{util.showVipPrice(goodsInfo.openVip, goodsInfo.vipprice)}}'>VIP ￥{{(goodsDetailInfo!=null)?goodsDetailInfo.vipprice:goodsInfo.vipprice}}</text> -->
							<text
								class="spec-stock">库存：{{ goodsDetailInfo != null ? util.isZero(goodsDetailInfo.rest) : goodsInfo.rest }}</text>
							<view style="line-height: 30rpx">
								<text v-if="!isAllSelected">请选择：</text>
								<text v-if="isAllSelected">已选择：</text>
								<text style="margin-right: 20rpx" v-for="(item, index) in selectText"
									:key="index">{{ item.spec }} {{ item.name }}</text>
							</view>
						</view>
						<!-- /商品信息 -->
					</view>
					<!-- /商品规格信息 -->
					<!-- 规格选择 -->
					<view class="sepc-content" v-for="(specSku, index) in specSku" :key="index">
						<text class="spec-content-title">{{ specSku.spec }}</text>

						<radio-group class="check-content" @change="radioChange" :data-index="index">
							<label :class="item.checked ? 'checkbox checked' : 'checkbox'"
								@tap="radio(specSku.spec,index1)"
								:style="'background-color: ' + (item.checked ? platformConfig.baseColor : '#F5F5F5')"
								v-for="(item, index1) in specSku.size" :key="item.name">
								<checkbox :value="item.name" :checked="item.checked" />

								{{ item.name }}
							</label>
						</radio-group>
					</view>
				</scroll-view>

				<!-- 购买按钮 -->
				<view v-if="rest > 0" class="btns">
					<!-- <button style='color: #fff; background-color: {{platformConfig.cssColor2}}' bindtap='closeSpecInfo'>取消</button> -->
					<button :style="'color: #fff; background-color: ' + platformConfig.baseColor"
						@tap="updateGoodsSpec">确认</button>
				</view>
				<view v-else class="btns">
					<button
						:style="'width:100%;color: #fff;padding: 0 !important; background-color: ' + platformConfig.backgroundColor"
						data-type="2" @tap="closeSpecInfo">
						非常抱歉，暂时无货
					</button>
				</view>
			</view>
		</view>

		<!-- 店铺优惠券信息 -->
		<view class="shadow-bg" v-if="couponShow" @touchmove.stop.prevent="trueFun">
			<view style="flex-grow: 1" @tap.stop.prevent="closeCoupons"></view>
			<view :class="'coupon-info ' + (couponShow ? 'slideUp' : '')" v-if="couponShow">
				<view class="coupon-header">
					<view class="coupon-line"></view>
					<text class="coupon-title">店铺优惠券</text>
				</view>
				<scroll-view class="coupon-list" scroll-y>
					<view class="coupon-list-item" v-for="(item, index) in coupons" :key="item.id">
						<view class="coupon-list-item-content">
							<view class="item-tag">
								<text>店铺券</text>
							</view>
							<view class="item-left">
								<block v-if="item.discountType == 0">
									<view class="item-discount">
										<view class="price-num">
											<text :style="'font-size: '+ item.fontSize + '; line-height: 60rpx'">{{ item.money }}</text>￥
										</view>
										<text class="discount-tip">满{{ item.limit }}元可用</text>
									</view>
								</block>
								<block v-else-if="item.discountType == 1">
									<view class="item-discount">
										<view class="discount-num">
											<text	style="font-size: 42rpx; line-height: 60rpx">{{ item.discount / 10 }}</text>折
										</view>
										<text class="discount-tip">满{{ item.limit }}元可用</text>
									</view>
								</block>

								<view class="item-detail">
									<text class="couponName">{{ item.name }}</text>
									<block v-if="item.isAllGoods == 0">
										<text>全部商品可用</text>
									</block>
									<block v-else-if="item.isAllGoods == 1">
										<text>部分商品可用</text>
									</block>

									<block v-if="item.couponEfType == 0">
										<text>{{ util.replaceDate(item.startdate) }}~{{ util.replaceDate(item.enddate) }}</text>
									</block>
									<block v-else-if="item.couponEfType == 1">
										<text>领取后{{ item.expireDay }}天有效</text>
									</block>
								</view>
							</view>

							<block>
								<view class="item-right">
									<text class="coupon-btn" :style="'background:' + platformConfig.baseColor"
										@tap="getCoupon(couponText[index].bindtap,item.id,item.cardFlag,index)">
										{{ couponText[index].text }}
									</text>
									<view class="coupon-desc-btn" @tap="showCouponDesc" :data-index="index"
										v-if="item.couponDesc">
										<text>规则详情</text>
										<image :src="staticBaseUrl + '/static/subPackages/mall/image/arrow-down-1.png'"
											:class="'arrow-down ' + (item.ifShowDetail ? 'rotate' : '')"></image>
									</view>
								</view>
							</block>
						</view>

						<view class="coupon-desc-text" v-if="item.ifShowDetail">
							<text>{{ item.couponDesc }}</text>
						</view>
					</view>
				</scroll-view>
			</view>
		</view>

		<view class="shadow-bg" v-if="payContentShow" @touchmove.stop.prevent="trueFun">
			<view style="flex-grow: 1" @tap.stop.prevent="closeSpecInfo"></view>
			<!-- 去结算弹框 -->
			<view v-if="payContentShow" class="pay-content">
				<view class="pay-title-content">
					<text>选择结算商品</text>
					<text class="iconfont icon-cuo1" @tap.stop.prevent="closePayContent"></text>
				</view>
				<view class="pay-warning">不同配送方式的商品暂不支持同时结算，请分开下单</view>
				<scroll-view class="pay-list" scroll-y>
					<view class="pay-item" v-if="expressGoods.length > 0">
						<view class="pay-item-title">
							快递发货
							<text class="total-goods">（共{{ expressGoods.length }}件）</text>
						</view>
						<view class="pay-goods">
							<view class="pay-goods-list">
								<view class="pay-goods-item" v-for="(item, index) in expressGoods"
									:key="item.memberCarId">
									<image :src="baseUrl + '/' + item.goodsImg"></image>
								</view>
							</view>
							<text class="pay-btn" data-deliverWay="0" @tap="toOrderConfirm">去结算</text>
						</view>
					</view>
					<view class="pay-item" v-if="dadaGoods.length > 0">
						<view class="pay-item-title">
							同城配送
							<text class="total-goods">（共{{ dadaGoods.length }}件）</text>
						</view>
						<view class="pay-goods">
							<view class="pay-goods-list">
								<view class="pay-goods-item" v-for="(item, index) in dadaGoods" :key="item.memberCarId">
									<image :src="baseUrl + '/' + item.goodsImg"></image>
								</view>
							</view>
							<text class="pay-btn" data-deliverWay="1" @tap="toOrderConfirm">去结算</text>
						</view>
					</view>
					<view class="pay-item" v-if="selfTakeGoods.length > 0">
						<view class="pay-item-title">
							到店自提
							<text class="total-goods">（共{{ selfTakeGoods.length }}件）</text>
						</view>
						<view class="pay-goods">
							<view class="pay-goods-list">
								<view class="pay-goods-item" v-for="(item, index) in selfTakeGoods"
									:key="item.memberCarId">
									<image :src="baseUrl + '/' + item.goodsImg"></image>
								</view>
							</view>
							<text class="pay-btn" data-deliverWay="2" @tap="toOrderConfirm">去结算</text>
						</view>
					</view>
				</scroll-view>
			</view>
		</view>
		<approvePop ref="toApprove"></approvePop>
	</view>
</template>
<script module="util" lang="wxs" src="../../utils/util.wxs"></script>
<script>
	import loading from '@/components/loading/loading';
	import approvePop from "@/components/approve-pop/approve-pop";
	import goodsRecommendation from '@/components/goodsRecommendation/goodsRecommendation';
	const app = getApp();

	var util = require('../../utils/util.js');
	import {
		staticBaseUrl
	} from '@/utils/constant.js'
	import {
		http
	} from '@/utils/commonRequest.js';

	export default {
		components: {
			loading,
			approvePop,
			goodsRecommendation
		},
		data() {
			return {
				staticBaseUrl: staticBaseUrl,
				loading: 1,
				//1加载中,0加载成功,-1加载失败
				refreshing: true,
				//刷新中
				baseUrl: app.globalData.baseurl,
				platformConfig: app.globalData.platformConfig,
				trolleyGoods: [],
				totalMoney: '0.00',
				totalNum: 0,
				choosedStore: {
					id: '',
					//存储已选择商店id
					index: -1,
					//存储已选择商店index，未选中的情况：-1
					calculateStoreId: '',
					//存储合计对应的商店id，即当前商店id
					calculateStoreIndex: -1,
					//存储当前商店index，未选中的情况：-1
					choosedGoods: [] //存储已选择商品的数据id
				},
				storeHidden: false,
				msgHidden: true,
				allChose: false,
				startX: 0,
				//滑动的开始坐标
				startY: 0,
				goodsInfo: null,
				//商品详细信息
				goodsDetailInfo: null,
				//根据规格查询的商品详情
				detailId: null,
				//商品规格详情ID
				num: 1,
				//选购商品数量
				rest: 0,
				//商品的库存数量
				showSku: false,
				//是否显示商品规格
				specInfoShow: false,
				//是否显示规格,
				specSku: [],
				//规格数组
				specSelect: false,
				//规格是否选中
				selectSpecSku: [],
				//已选择的规格数组
				selectText: [],
				//选择的规格文本
				selectSpecName: [],
				//选择的规格名数组
				isAllSelected: 0,
				//规格选择是否完成
				specInfoShow: false,
				//是否显示规格,
				currentId: null,
				//当前选择的商品
				couponShow: false,
				//是否显示优惠券
				coupons: [],
				//优惠券列表
				choseCoupon: [],
				//记录当前选择的优惠券
				couponText: [],
				//优惠券列表相关信息
				payContentShow: false,
				//去结算弹框是否显示
				dadaGoods: [],
				//支持同城配送的商品
				expressGoods: [],
				//支持快递的商品
				//支持到店自提的商品
				selfTakeGoods: [],
				storeid: '',
				store: {
					id: '',
					isAllChose: false,
					name: '',
					goods: []
				},

				storeIndex: 0,

				goods: {
					isTouchMove: false,
					id: '',
					isChose: false,
					goodsId: '',
					img: '',
					name: '',
					spec: '',
					showVipDiscount: '',
					number: '',
					skuRest: ''
				},

				goodsIndex: 0,
				text: '',
				cannotBtn:false
			};
		},
		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad: function(options) {
			this.$zhuge.track('进入购物车页面')
			this.platformConfig = app.globalData.platformConfig
		},
		/**
		 * 切换页面时隐藏弹出的规格选择框和优惠券选择框
		 */
		onHide() {
			var that = this;
			that.specInfoShow = false
			that.couponShow = false
		},
		onPullDownRefresh: function() {
			console.log('Refresh');

			if (this.refreshing) {
				return;
			}

			this.refreshing = true;
			this.loadData();

			if (this.$refs.goodsRecommendation) {
				this.$refs.goodsRecommendation.clearRecommendGoods();
			}

			uni.stopPullDownRefresh();
		},
		/**
		 * 生命周期函数--监听页面显示
		 */
		onShow: function() {
			this.loadData();
		},
		/**
		 * 页面上拉触底事件的处理函数
		 */
		onReachBottom: function() {
			return;
		},
		methods: {
			loadData: function() {
				this.$checkLogin()
					.then((res) => {
						this.getPlatformConfig();
					})
					.catch((err) => {
						this.loading = -1
						this.refreshing = false;
						uni.stopPullDownRefresh();
					});
			},

			/**
			 * 获取平台配置信息
			 */
			getPlatformConfig: function() {
				var that = this;
				app.globalData
					.getPlatformConfig()
					.then((res) => {
						that.platformConfig = res
						that.getTrolley();
					})
					.catch((err) => {
						that.loading = -1
						that.refreshing = false;
						uni.stopPullDownRefresh();
					});
			},

			/**
			 * 获取购物车
			 */
			getTrolley: function() {
				var that = this;

				if (that.loading == 0) {
					uni.showLoading({
						title: '加载中'
					});
				}

				http.get('/shopTrolley/trolleyGoods', {})
					.then((res) => {
						res = res.data
						if (200 == res.code) {
							var result = res.stores;
							if (result.length > 0) {
								that.storeHidden = false
								that.msgHidden = true
								that.allChose = false
								that.loading = 0
								let goods = result[0].goods
								if(goods && goods.length > 0) {
									goods.map((item, index) => {
									if(item.isPurchaseLimit == '1' && (item.number > item.eachOrderConvertMaxNumber)) {
										item.cannotBtn = true
										util.tips(`您兑换的${item.name}数量已达上限`)
									} else {
										item.cannotBtn = false
									}
									})
								}
								
								that.compareWithCache(result);
								that.calculate();
							} else {
								that.storeHidden = true
								that.msgHidden = false
								that.trolleyGoods = []
								that.allChose = false
								that.loading = 0
								uni.removeStorageSync('TROLLEY_GOODS');
								this.$nextTick(() =>{
									if (this.$refs.goodsRecommendation) {
										this.$refs.goodsRecommendation.getRecommendGoods();
									}
								})
							} //结束加载

							uni.hideLoading();
						} else {
							uni.hideLoading();
							that.loading = -1
						}

						that.refreshing = false;
						uni.stopPullDownRefresh();
					})
					.catch((err) => {
						uni.hideLoading();
						that.loading = -1
						that.refreshing = false;
						uni.stopPullDownRefresh();
					});
			},

			renderTrolley: function(result) {
				if (result.length > 0) {
					this.storeHidden = false
					this.msgHidden = true
					this.allChose = false
					this.loading = 0
					this.compareWithCache(result);
					this.calculate();
				} else {
					this.storeHidden = true
					this.msgHidden = false
					this.trolleyGoods = []
					this.allChose = false
					this.loading = 0
					uni.removeStorageSync('TROLLEY_GOODS');

					if (this.$refs.goodsRecommendation) {
						this.$refs.goodsRecommendation.getRecommendGoods();
					}
				}
			},

			/**
			 * 与缓存中的购物车数据比较
			 * 1.缓存中原来没有的商品，说明是新加进来的商品（无法完全保证如此），则新加进来的商品默认选中
			 * 2.根据缓存中的选中商品，同步查询出来的商品选中状态
			 * 3.更新缓存
			 */
			compareWithCache: function(trolleyGoods) {
				var goodsArr = [];
				var goods = {};
				var goodsChoseCount = 0; //一个商铺中商品选择数量

				var storeAllChoseCount = 0; //商品全部选中的商铺数量

				var allChose = false; //全部商铺的全部商品是否选中

				var trolleyGoodsCache = uni.getStorageSync('TROLLEY_GOODS'); //缓存的购物车商品

				var trolleyGoodsCacheNew = {};
				var choosedStoreTemp = this.choosedStore;
				choosedStoreTemp.choosedGoods = [];

				for (var i = 0, iLen = trolleyGoods.length; i < iLen; i++) {
					goodsArr = trolleyGoods[i].goods;
					goodsChoseCount = 0;

					for (var j = 0, jLen = goodsArr.length; j < jLen; j++) {
						goods = goodsArr[j]; // choosedStoreTemp.choosedGoods.push(goods.id);

						if (undefined == trolleyGoodsCache[goods.id] || trolleyGoodsCache[goods.id].isChose) {
							//新加入购物车的商品、或缓存中该商品已选中
							goods.isChose = true;
							goodsChoseCount++;
							choosedStoreTemp.choosedGoods.push(goods.id);
						} //更新缓存数据

						trolleyGoodsCacheNew[goods.id] = goods;
					}

					if (goodsChoseCount > 0) {
						trolleyGoods[i].isChose = true;
					}

					if (goodsChoseCount == goodsArr.length) {
						trolleyGoods[i].isAllChose = true;
						storeAllChoseCount++;
					}
				}

				if (storeAllChoseCount == trolleyGoods.length) {
					allChose = true;
				}

				this.trolleyGoods = trolleyGoods
				this.allChose = allChose
				this.choosedStore = choosedStoreTemp
				console.log(choosedStoreTemp.choosedGoods.length + '已选中商品--->' + choosedStoreTemp.choosedGoods);
				uni.setStorageSync('TROLLEY_GOODS', trolleyGoodsCacheNew); //将购物车商品一维对象存储起来，提高计算速度

				this.trolleyGoodsFlat = trolleyGoodsCacheNew;
			},

			/**
			 * 初始化选中数据
			 */
			initChoosedStore: function() {
				let that = this;
				var initData = that.choosedStore;
				initData.id = '';
				initData.index = -1;
				initData.calculateStoreId = '';
				initData.calculateStoreIndex = -1;
				initData.choosedGoods = [];
				that.choosedStore = initData
				uni.removeStorageSync('CHOOSED_STORE');
				uni.removeStorageSync('trolleyGoods');
			},

			// getCacheChoosedStore: function() {
			//   let that = this;
			//   var choosedStore = wx.getStorageSync('CHOOSED_STORE');
			//   if (choosedStore == '' || choosedStore == undefined) {
			//     var initData = that.data.choosedStore;
			//     initData.id = "";
			//     initData.index = -1;
			//     initData.calculateStoreId = "";
			//     initData.calculateStoreIndex = -1;
			//     initData.choosedGoods = [];
			//     that.setData({
			//       choosedStore: initData
			//     });
			//   } else {
			//     that.setData({
			//       choosedStore: choosedStore
			//     });
			//   }
			// },

			/**
			 * 编辑：全选
			 */
			chooseAll: function() {
				var trolleyGoods = this.trolleyGoods;
				var allChose = !this.allChose;
				var trolleyGoodsCacheNew = {};
				var choosedStoreTemp = this.choosedStore;
				var choosedGoods = [];

				for (var i = 0, iLen = trolleyGoods.length; i < iLen; i++) {
					trolleyGoods[i].isChose = allChose;
					trolleyGoods[i].isAllChose = allChose;

					for (var j = 0, jLen = trolleyGoods[i].goods.length; j < jLen; j++) {
						trolleyGoods[i].goods[j].isChose = allChose; //更新缓存数据

						trolleyGoodsCacheNew[trolleyGoods[i].goods[j].id] = trolleyGoods[i].goods[j];

						if (allChose) {
							choosedGoods.push(trolleyGoods[i].goods[j].id);
						}
					}
				}

				choosedStoreTemp.choosedGoods = choosedGoods;
				this.trolleyGoods = trolleyGoods
				this.allChose = allChose
				this.choosedStore = choosedStoreTemp
				uni.setStorageSync('TROLLEY_GOODS', trolleyGoodsCacheNew);
				this.trolleyGoodsFlat = trolleyGoodsCacheNew;
				this.calculate();
			},

			/**
			 * 编辑：多选删除购物车
			 */
			deleteTrolleys: function() {
				let that = this;
				var trolleyGoods = this.trolleyGoodsFlat;
				var deleteGoods = [];

				for (var trolleyId in trolleyGoods) {
					if (trolleyGoods[trolleyId].isChose) {
						deleteGoods.push(trolleyId);
					}
				}

				console.log(deleteGoods);

				if (deleteGoods.length == 0) {
					uni.showToast({
						icon: 'none',
						title: '请选择需要删除的商品',
						duration: 2000
					});
					return;
				}

				var ids = deleteGoods.join('-');
				uni.showModal({
					title: '提示',
					content: '确认删除所选项？',
					cancelColor: '#158cfb',
					confirmColor: '#158cfb',
					success: function(res) {
						if (res.confirm) {
							http.post('/shopTrolley/deleteTrolleys', {
									ids: ids
								}, {
									header: {
										"content-type": "application/x-www-form-urlencoded"
									}
								})
								.then((res) => {
									res = res.data
									if (200 == res.code) {
										uni.showToast({
											icon: 'none',
											title: '删除成功',
											duration: 2000
										});
										that.renderTrolley(res.stores);
									} else {
										uni.showToast({
											icon: 'none',
											title: res.msg,
											duration: 2000
										});
										that.getTrolley();
									}
								});
						}
					}
				});
			},

			/**
			 * 点击商店选择
			 */
			chooseStore: function(e) {
				var storeIndex = e.target.dataset.storeIndex;
				var trolleyGoodsCache = uni.getStorageSync('TROLLEY_GOODS'); //缓存的购物车商品

				console.log(storeIndex);
				var allChose = true;
				var trolleyGoods = this.trolleyGoods;
				var storeAllChose = !trolleyGoods[storeIndex].isAllChose;
				var choosedStoreTemp = this.choosedStore;
				var choosedGoodsTemp = [];
				trolleyGoods[storeIndex].isChose = storeAllChose;
				trolleyGoods[storeIndex].isAllChose = storeAllChose;

				for (var j = 0, jLen = trolleyGoods[storeIndex].goods.length; j < jLen; j++) {
					trolleyGoods[storeIndex].goods[j].isChose = storeAllChose;
					trolleyGoodsCache[trolleyGoods[storeIndex].goods[j].id] = trolleyGoods[storeIndex].goods[j];

					if (storeAllChose) {
						//商铺中所有商品全选，需要看已选总数组中有没有因为这次选择没有添加的
						var isContains = false;

						for (var m = 0, mLen = choosedStoreTemp.choosedGoods.length; m < mLen; m++) {
							if (trolleyGoods[storeIndex].goods[j].id == choosedStoreTemp.choosedGoods[m]) {
								isContains = true;
							}
						}

						if (!isContains) {
							choosedStoreTemp.choosedGoods.push(trolleyGoods[storeIndex].goods[j].id);
						}
					}
				}

				if (!storeAllChose) {
					//商铺所有商品全部取消勾选，需要看已选总数组中有没有需要剔除的
					for (var m = 0, mLen = choosedStoreTemp.choosedGoods.length; m < mLen; m++) {
						var isContains = false;

						for (var j = 0, jLen = trolleyGoods[storeIndex].goods.length; j < jLen; j++) {
							if (trolleyGoods[storeIndex].goods[j].id == choosedStoreTemp.choosedGoods[m]) {
								isContains = true;
							}
						}

						if (!isContains) {
							choosedGoodsTemp.push(choosedStoreTemp.choosedGoods[m]);
						}
					}

					choosedStoreTemp.choosedGoods = choosedGoodsTemp;
				}

				if (trolleyGoods[storeIndex].isAllChose) {
					//该店铺商品变为全选后，判断是否所有商铺全选
					for (var i = 0, iLen = trolleyGoods.length; i < iLen; i++) {
						if (!trolleyGoods[i].isAllChose) {
							allChose = false;
							break;
						}
					}
				} else {
					allChose = false;
				}

				this.trolleyGoods = trolleyGoods
				this.allChose = allChose
				this.choosedStore = choosedStoreTemp
				uni.setStorageSync('TROLLEY_GOODS', trolleyGoodsCache);
				this.trolleyGoodsFlat = trolleyGoodsCache;
				this.calculate();
			},

			/**
			 * 点击商品选择
			 */
			chooseGoods: function(e) {
				var storeIndex = e.target.dataset.storeIndex;
				var goodsIndex = e.target.dataset.goodsIndex;
				var goodId = e.target.dataset.goodId;
				var trolleyGoodsCache = uni.getStorageSync('TROLLEY_GOODS'); //缓存的购物车商品

				var choosedStoreTemp = this.choosedStore;
				console.log(storeIndex + ' ' + goodsIndex);
				var allChose = true;
				var trolleyGoods = this.trolleyGoods;
				var goodsChose = !trolleyGoods[storeIndex].goods[goodsIndex].isChose; //该商品是否被选中

				trolleyGoods[storeIndex].goods[goodsIndex].isChose = goodsChose;
				trolleyGoodsCache[trolleyGoods[storeIndex].goods[goodsIndex].id] = trolleyGoods[storeIndex].goods[
					goodsIndex]; //判断该店铺商品是否被选中，是否被全部选中

				var goodsChoseCount = 0; //该商铺中商品选择数量
				for (var j = 0, jLen = trolleyGoods[storeIndex].goods.length; j < jLen; j++) {
					if (trolleyGoods[storeIndex].goods[j].isChose) {
						goodsChoseCount++;
					}
				}
				
				if(trolleyGoods[storeIndex].goods[goodsIndex].cannotBtn && trolleyGoods[storeIndex].goods[goodsIndex].isChose){
					this.cannotBtn = true
				} else {
					this.cannotBtn = false
				}

				if (goodsChoseCount > 0) {
					trolleyGoods[storeIndex].isChose = true;
				}

				if (goodsChoseCount == trolleyGoods[storeIndex].goods.length) {
					trolleyGoods[storeIndex].isAllChose = true;
				} else {
					trolleyGoods[storeIndex].isAllChose = false;
				}

				if (goodsChose) {
					choosedStoreTemp.choosedGoods.push(goodId);

					if (trolleyGoods[storeIndex].isAllChose) {
						//若该商品被选中，导致该店铺商品被全选中，则需要判断是否所有商铺被全部选中
						for (var i = 0, iLen = trolleyGoods.length; i < iLen; i++) {
							if (!trolleyGoods[i].isAllChose) {
								allChose = false;
								break;
							}
						}
					} else {
						allChose = false;
					}
				} else {
					var choosedGoodsNew = [];

					for (var m = 0, mLen = choosedStoreTemp.choosedGoods.length; m < mLen; m++) {
						if (choosedStoreTemp.choosedGoods[m] != goodId) {
							choosedGoodsNew.push(choosedStoreTemp.choosedGoods[m]);
						}
					}

					choosedStoreTemp.choosedGoods = choosedGoodsNew;
					allChose = false;
				} // if (goodsChose && trolleyGoods[storeIndex].isAllChose) {
				//   choosedStoreTemp.choosedGoods.push(goodId);
				//   //若该商品被选中，导致该店铺商品被全选中，则需要判断是否所有商铺被全部选中
				//   for (var i = 0, iLen = trolleyGoods.length; i < iLen; i++) {
				//     if (!trolleyGoods[i].isAllChose) {
				//       allChose = false;
				//       break;
				//     }
				//   }
				// } else {
				//   var choosedGoodsNew = [];
				//   for (var m = 0, mLen = choosedStoreTemp.choosedGoods.length;m < mLen;m++){
				//     if (choosedStoreTemp.choosedGoods[m] != goodId){
				//       choosedGoodsNew.push(choosedStoreTemp.choosedGoods[m]);
				//     }
				//   }
				//   choosedStoreTemp.choosedGoods = choosedGoodsNew;
				//   allChose = false;
				// }

				this.trolleyGoods = trolleyGoods
				this.allChose = allChose
				this.choosedStore = choosedStoreTemp
				uni.setStorageSync('TROLLEY_GOODS', trolleyGoodsCache);
				this.trolleyGoodsFlat = trolleyGoodsCache;
				this.calculate();
			},

			/**
			 * 删除购物车商品
			 */
			deleteTrolley: function(e) {
				let that = this;
				var deleteId = e.currentTarget.dataset.deleteId;
				console.log(deleteId);
				uni.showModal({
					title: '提示',
					content: '确认需要删除吗？',
					cancelColor: '#158cfb',
					confirmColor: '#158cfb',
					success: function(res) {
						if (res.confirm) {
							http.post('/shopTrolley/deleteTrolley', {
									id: deleteId
								}, {
									header: {
										"content-type": "application/x-www-form-urlencoded"
									}
								})
								.then((res) => {
									res = res.data
									console.log(res);

									if (200 == res.code) {
										var result = res.msg;

										if ('SUCCESS' === result) {
											uni.showToast({
												icon: 'none',
												title: '删除成功',
												duration: 2000
											});
										}

										that.getTrolley();
										that.renderTrolley(res.stores);
									} else {
										that.getTrolley();
									}
								});
						}
					}
				});
			},

			/**
			 * 购物车商品数量减1
			 */
			minusTrolley: function(e) {
				let that = this;
				var storeIndex = e.target.dataset.storeIndex;
				var goodsIndex = e.target.dataset.goodsIndex;
				console.log(storeIndex + ' ' + goodsIndex);
				var trolleyGoods = that.trolleyGoods;
				var goods = trolleyGoods[storeIndex].goods[goodsIndex];
				
				console.log('before: number = ' + goods.number);
				console.log('id = ' + goods.id);

				if (goods.number <= 1) {
					uni.showToast({
						icon: 'none',
						title: '不能再少啦',
						duration: 2000
					});
				} else {
					//调接口数量-1
					http.post('/shop/minusTrolley', {
							id: goods.id
						}, {
							header: {
								"content-type": "application/x-www-form-urlencoded"
							}
						})
						.then((res) => {
							res = res.data
							console.log(res);

							if('516' == res.code){
								if(goods.isChose) {
									this.cannotBtn = true
								} else {
									this.cannotBtn = false
								}
								goods.cannotBtn = true
							    util.tips(res.msg)
							    this.loading = 0
							} else if (200 == res.code) {
								var result = res.msg;
								goods.cannotBtn = false
								this.cannotBtn = false

								if ('SUCCESS' === result) {
									goods.number -= 1;
									that.trolleyGoods = trolleyGoods
									var trolleyGoodsCache = uni.getStorageSync('TROLLEY_GOODS');
									trolleyGoodsCache[goods.id] = goods;
									uni.setStorageSync('TROLLEY_GOODS', trolleyGoodsCache);
									that.trolleyGoodsFlat = trolleyGoodsCache;
									that.calculate();
									console.log('after: number = ' + that.trolleyGoods[storeIndex].goods[
										goodsIndex].number);
								}
							}
						});
				}
			},

			/**
			 * 购物车商品数量加1
			 */
			plusTrolley: function(e) {
				let that = this;
				var storeIndex = e.target.dataset.storeIndex;
				var goodsIndex = e.target.dataset.goodsIndex;
				console.log(storeIndex + ' ' + goodsIndex);
				var trolleyGoods = that.trolleyGoods;
				var goods = trolleyGoods[storeIndex].goods[goodsIndex];
				console.log('before: number = ' + goods.number);
				console.log('id = ' + goods.id); //调接口数量+1

				http.post('/shop/plusTrolley', {
						id: goods.id
					}, {
						header: {
							"content-type": "application/x-www-form-urlencoded"
						}
					})
					.then((res) => {
						res = res.data
						console.log(res);

						if('516' == res.code){
							goods.cannotBtn = true
						    util.tips(res.msg)
						    this.loading = 0
						} else if (200 == res.code) {
							var result = res.msg;
							goods.cannotBtn = false
							this.cannotBtn = false

							if ('SUCCESS' === result) {
								goods.number = parseInt(goods.number) + parseInt(1);
								that.trolleyGoods = trolleyGoods
								var trolleyGoodsCache = uni.getStorageSync('TROLLEY_GOODS');
								trolleyGoodsCache[goods.id] = goods;
								uni.setStorageSync('TROLLEY_GOODS', trolleyGoodsCache);
								that.trolleyGoodsFlat = trolleyGoodsCache;
								that
									.calculate(); // console.log("after: number = " + that.data.trolleyGoods[indexx].goods[indexy].number);
							} else if ('ERROR' === result) {
								uni.showToast({
									icon: 'none',
									title: '库存不足！',
									duration: 2000
								});
							}
						}
					});
			},

			/**
			 * 计算金额
			 */
			calculate: function() {
				var totalMoney = 0;
				var totalNum = 0;
				var trolleyGoods1 = this.trolleyGoods;
				var trolleyGoods = this.trolleyGoodsFlat;

				for (var trolleyId in trolleyGoods) {
					if (trolleyGoods[trolleyId].isChose) {
						totalNum += trolleyGoods[trolleyId].number; // var discount = 100;
						// if ("1" == trolleyGoods[trolleyId].joinMbrDiscount){//会员折扣价格
						//   for (var i = 0; i < trolleyGoods1.length;i++){//遍历每个商店的商品，找到该折扣商品所属的商店，拿到折扣
						//     var goods = trolleyGoods1[i].goods;//每个商铺的所有商品
						//     for (var j = 0; j < goods.length; j++) {
						//       if (goods[j].id == trolleyGoods[trolleyId].id && trolleyGoods1[i].discount != undefined){
						//         discount = trolleyGoods1[i].discount;
						//         break;
						//       }
						//     }
						//   }
						//   totalMoney += (parseFloat(trolleyGoods[trolleyId].price) * discount / 100).toFixed(2) * trolleyGoods[trolleyId].number;
						// } else {
						//   totalMoney += parseFloat(trolleyGoods[trolleyId].price) * trolleyGoods[trolleyId].number;
						// }

						if (trolleyGoods[trolleyId].showVipDiscount) {
							totalMoney += parseFloat(trolleyGoods[trolleyId].vipPrice) * trolleyGoods[trolleyId]
								.number;
						} else {
							totalMoney += parseFloat(trolleyGoods[trolleyId].price) * trolleyGoods[trolleyId].number;
						}
					}
				}

				totalMoney = totalMoney.toFixed(2);
				this.totalMoney = totalMoney
				this.totalNum = totalNum
			},

			/**
			 * 判断是否要跳转到区分快递投送方式页面
			 */
			toCheckGoodsDeliveryWay: function() {
				let that = this;
				var goodsIds = that.choosedStore.choosedGoods;

				if (goodsIds.length <= 0) {
					uni.showToast({
						icon: 'none',
						title: '请选择商品！',
						duration: 2000
					});
					return;
				}

				var ids = '';

				for (var i = 0; i < goodsIds.length; i++) {
					ids = ids + goodsIds[i] + '-';
				}

				http.get('/shopLogistic/checkGoodsDeliverWay', {
						ids: ids
					})
					.then((res) => {
						console.log(res);

						if (200 == res.code) {
							var result = res.msg;
							console.log(result);

							if ('ERROR' === result) {
								// wx.showToast({
								//   icon: 'none',
								//   title: "该商品已下架，请选择其他商品！",
								//   duration: 2000
								// });
							} else {
								//跳转
								var dadaGoods = res.dadaGoods;
								var expressGoods = res.expressGoods;
								var selfTakeGoods = res.selfTakeGoods; //极端情况，将要结算的商品不支持任何物流方式

								if (dadaGoods.length == 0 && expressGoods.length == 0 && selfTakeGoods.length ==
									0) {
									uni.showToast({
										icon: 'none',
										title: '当前选择的商品没有可用的物流配送方式！',
										duration: 2000
									});
									return;
								} //1.快递 2.自提 3.同城配送 0.不支持

								var selectedDeliverWay = 0; //1（001） 快递 2（010）自取 4（100）同城配送

								var allSupportedDeliveryWay = 0; //当有且仅有一个派送方式有商品时，直接跳转到订单确认页面

								if (goodsIds.length == expressGoods.length && goodsIds.length == selfTakeGoods
									.length && goodsIds.length == dadaGoods.length) {
									//三种物流方式都支持
									allSupportedDeliveryWay = 1 | 2 | 4;
									selectedDeliverWay = 1;
									console.log('来自购物车：所有待支付商品支持三种配送方式');
								} else if (goodsIds.length == expressGoods.length && goodsIds.length ==
									selfTakeGoods.length) {
									//都支持快递和自提
									allSupportedDeliveryWay = 1 | 2;
									selectedDeliverWay = 1;
									console.log('来自购物车：所有待支付商品支持快递和自提');
								} else if (goodsIds.length == expressGoods.length && goodsIds.length == dadaGoods
									.length) {
									//都支持快递和同城配送
									allSupportedDeliveryWay = 1 | 4;
									selectedDeliverWay = 1;
									console.log('来自购物车：所有待支付商品支持快递和同城配送');
								} else if (goodsIds.length == selfTakeGoods.length && goodsIds.length == dadaGoods
									.length) {
									//都支持同城配送和自提
									allSupportedDeliveryWay = 2 | 4;
									selectedDeliverWay = 3;
									console.log('来自购物车：所有待支付商品支持同城配送和自提');
								} else if (expressGoods.length == goodsIds.length && selfTakeGoods.length == 0 &&
									dadaGoods.length == 0) {
									allSupportedDeliveryWay = 1;
									selectedDeliverWay = 1;
									console.log('来自购物车：所有待支付商品仅支持快递配送');
								} else if (expressGoods.length == 0 && selfTakeGoods.length == goodsIds.length &&
									dadaGoods.length == 0) {
									allSupportedDeliveryWay = 2;
									selectedDeliverWay = 2;
									console.log('来自购物车：所有待支付商品仅支到店自提');
								} else if (expressGoods.length == 0 && selfTakeGoods.length == 0 && dadaGoods
									.length == goodsIds.length) {
									allSupportedDeliveryWay = 4;
									selectedDeliverWay = 3;
									console.log('来自购物车：所有待支付商品仅支持同城配送');
								}

								var params = {};
								params.allSupportedDeliveryWay = allSupportedDeliveryWay;
								params.preSelectDeliveryWay = selectedDeliverWay; //购物车欲结算商品支持的物流方式完全一样，则直接跳转订单确认页面

								if (allSupportedDeliveryWay != 0) {
									that.toOrder(params);
									return;
								}

								that.payContentShow = true
								that.dadaGoods = dadaGoods
								that.expressGoods = expressGoods
								that.selfTakeGoods = selfTakeGoods
								return;
							}
						}
					});
			},

			/**
			 * 跳转确认订单页面
			 */
			toOrder: function(params) {
				let that = this;
				var supportedDeliveryWay = params.allSupportedDeliveryWay;
				var preSelectDeliveryWay = params.preSelectDeliveryWay;
				var goodsIds = that.choosedStore.choosedGoods;
				console.log('购买的商品goodsIds{}:' + goodsIds);

				if (goodsIds.length > 0) {
					var ids = goodsIds[0];

					if (goodsIds.length > 1) {
						for (var i = 1; i < goodsIds.length; i++) {
							ids = ids + '-' + goodsIds[i];
						}
					}

					console.log('传递的ids{}:' + ids);
					uni.navigateTo({
						url: '/subPackages/mall/pages/sure/sure?ids=' +
							ids +
							'&sureType=trolley&supportedDeliverWay=' +
							supportedDeliveryWay +
							'&preSelectDeliveryWay=' +
							preSelectDeliveryWay
					});
				} else {
					// wx.showToast({
					//   icon: 'none',
					//   title: "请选择商品！",
					//   duration: 2000
					// });
					return;
				}
			},

			/**
			 *由物流方式选择后跳转确认订单页面
			 */
			toOrderConfirm: function(event) {
				let noApprove = uni.getStorageSync('noApproveFlag')
				if(noApprove){
					this.$refs.toApprove.openShow();
					return
				}
				let that = this;
				var goodsIds = [];
				var selectedDeliverWay = event.target.dataset.deliverway;
				var preSelectDeliveryWay = 0; //传递到订单确认页面的已选择的物流方式

				var supportedDeliverWay = 0;

				if (selectedDeliverWay == '0') {
					//快递发货
					preSelectDeliveryWay = 1;
					goodsIds = that.expressGoods;
					supportedDeliverWay = 1;

					if (that.isArrayContained(that.dadaGoods, goodsIds)) {
						supportedDeliverWay = supportedDeliverWay | 4;
						console.log('来自购物车：所有待支付商品支持快递' + supportedDeliverWay == 5 ? '和同城配送' : '');
					} else if (that.isArrayContained(that.selfTakeGoods, goodsIds)) {
						supportedDeliverWay = supportedDeliverWay | 2;
						console.log('来自购物车：所有待支付商品支持快递' + supportedDeliverWay == 3 ? '和自提' : '');
					}
				} else if (selectedDeliverWay == '1') {
					//同城派送
					preSelectDeliveryWay = 3;
					supportedDeliverWay = 4;
					goodsIds = that.dadaGoods;

					if (that.isArrayContained(that.expressGoods, goodsIds)) {
						supportedDeliverWay = supportedDeliverWay | 1;
						console.log('来自购物车：所有待支付商品支持同城配送' + supportedDeliverWay == 5 ? '和快递' : '');
					} else if (that.isArrayContained(that.selfTakeGoods, goodsIds)) {
						supportedDeliverWay = supportedDeliverWay | 2;
						console.log('来自购物车：所有待支付商品支持同城配送' + supportedDeliverWay == 6 ? '和自提' : '');
					}
				} else {
					//到店自提
					preSelectDeliveryWay = 2;
					supportedDeliverWay = 2;
					goodsIds = that.selfTakeGoods;

					if (that.isArrayContained(that.expressGoods, goodsIds)) {
						supportedDeliverWay = supportedDeliverWay | 1;
						console.log('来自购物车：所有待支付商品支持到店自提' + supportedDeliverWay == 3 ? '和快递' : '');
					} else if (that.isArrayContained(that.dadaGoods, goodsIds)) {
						supportedDeliverWay = supportedDeliverWay | 4;
						console.log('来自购物车：所有待支付商品支持到店自提' + supportedDeliverWay == 6 ? '和同城配送' : '');
					}
				}

				console.log('购买的商品goodsIds{}:' + goodsIds);

				if (goodsIds.length > 0) {
					var ids = goodsIds[0].memberCarId;

					if (goodsIds.length > 1) {
						for (var i = 1; i < goodsIds.length; i++) {
							ids = ids + '-' + goodsIds[i].memberCarId;
						}
					}

					console.log('传递的ids{}:' + ids);
					uni.navigateTo({
						url: '/subPackages/mall/pages/sure/sure?ids=' +
							ids +
							'&sureType=trolley&supportedDeliverWay=' +
							supportedDeliverWay +
							'&preSelectDeliveryWay=' +
							preSelectDeliveryWay
					}); //隐藏掉物流选择方式弹框

					this.payContentShow = false
					this.dadaGoods = []
					this.expressGoods = []
					this.selfTakeGoods = []
				}
			},

			/**
			 * 去结算，不需要检查配送方式
			 *
			 */
			toAccount: function() {
				let noApprove = uni.getStorageSync('noApproveFlag')
				if(noApprove){
					this.$refs.toApprove.openShow();
					return
				}
				var goodsIds = this.choosedStore.choosedGoods;
				console.log('去结算时购买的商品goodsIds{}:' + goodsIds);

				if (goodsIds.length > 0) {
					var ids = goodsIds[0];

					if (goodsIds.length > 1) {
						for (var i = 1; i < goodsIds.length; i++) {
							ids = ids + '-' + goodsIds[i];
						}
					}

					console.log('传递的ids{}:' + ids);
					uni.navigateTo({
						url: '/subPackages/mall/pages/sure/sure?ids=' + ids + '&sureType=trolley'
					});
				} else {
					uni.showToast({
						icon: 'none',
						title: '请选择商品！',
						duration: 2000
					});
					return;
				}
			},

			/**
			 * 数组a是否包含数组b
			 */
			isArrayContained: function(a, b) {
				if (!(a instanceof Array) || !(b instanceof Array) || a.length < b.length) {
					return false;
				}

				var aId = [];
				var bId = [];

				for (var i = 0; i < a.length; i++) {
					aId.push(a[i].memberCarId);
				}

				for (var i = 0; i < b.length; i++) {
					bId.push(b[i].memberCarId);
				}

				for (var i = 0; i < bId.length; i++) {
					if (aId.indexOf(bId[i]) < 0) {
						return false;
					}
				}

				return true;
			},

			/**
			 * 购物车商品跳转商品详情页面
			 */
			checkGoodsOn: function(e) {
				let that = this;
				let goodsId = e.currentTarget.dataset.goodsid;
				console.log(goodsId);
				http.get('/shop/goodsOn', {
						params: {
							id: goodsId
						}
					})
					.then((res) => {
						res = res.data
						console.log(res);

						if (200 == res.code) {
							var result = res.msg;

							if ('ERROR' === result) {
								uni.showToast({
									icon: 'none',
									title: '该商品已下架，请选择其他商品！',
									duration: 2000
								});
							} else {
								let item = e.currentTarget.dataset.item;
								this.$zhuge.track('点击商品',{
									'当前页面': '购物车页面',
									'商品名称': item.name,
									'商品金额': item.price
								})
								//跳转
								uni.navigateTo({
									url: '/subPackages/mall/pages/goods/goods?goodsId=' + goodsId
								});
							}
						}
					});
			},

			//手指触摸动作开始 记录起点X坐标
			touchstart: function(e) {
				var storeIndex = e.currentTarget.dataset.storeIndex;
				console.log('----->' + storeIndex);
				var goods = this.trolleyGoods[storeIndex].goods; //开始触摸时 重置所有删除

				for (var m = 0, mLen = this.trolleyGoods.length; m < mLen; m++) {
					this.trolleyGoods[m].goods.forEach(function(v, i) {
						if (v.isTouchMove) {
							//只操作为true的
							v.isTouchMove = false;
						}
					});
				} // goods.forEach(function(v, i) {
				//   if (v.isTouchMove) //只操作为true的
				//     v.isTouchMove = false;
				// })

				this.trolleyGoods[storeIndex].goods = goods;
				this.startX = e.changedTouches[0].clientX
				this.startY = e.changedTouches[0].clientY
				this.$set(this.trolleyGoods, storeIndex, this.trolleyGoods[storeIndex])
			},

			//滑动事件处理
			touchmove: function(e) {
				var storeIndex = e.currentTarget.dataset.storeIndex;
				var that = this;
				var goods = that.trolleyGoods[storeIndex].goods;
				var index = e.currentTarget.dataset.index;
				var //当前索引
					startX = that.startX;
				var //开始X坐标
					startY = that.startY;
				var //开始Y坐标
					touchMoveX = e.changedTouches[0].clientX;
				var //滑动变化坐标
					touchMoveY = e.changedTouches[0].clientY;
				var //滑动变化坐标
					//获取滑动角度
					angle = that.angle({
						X: startX,
						Y: startY
					}, {
						X: touchMoveX,
						Y: touchMoveY
					});
				goods.forEach(function(v, i) {
					v.isTouchMove = false; //滑动超过30度角 return

					if (Math.abs(angle) > 30) {
						return;
					}

					if (i == index) {
						if (touchMoveX > startX) {
							//右滑
							v.isTouchMove = false;
						} else {
							//左滑
							v.isTouchMove = true;
						}
					}
				});
				that.trolleyGoods[storeIndex].goods = goods; //更新数据
				this.$set(this.trolleyGoods, storeIndex, this.trolleyGoods[storeIndex])
			},

			/**
			 * 计算滑动角度
			 * @param {Object} start 起点坐标
			 * @param {Object} end 终点坐标
			 */
			angle: function(start, end) {
				var _X = end.X - start.X;

				var _Y = end.Y - start.Y; //返回角度 /Math.atan()返回数字的反正切值

				return (360 * Math.atan(_Y / _X)) / (2 * Math.PI);
			},

			/**
			 * 判断输入的值是否为0
			 */
			isEqualZero: function(e) {
				var value = e.detail.value;
				var skuRest = e.target.dataset.skurest;
				var pos = e.detail.cursor;
				let that = this;
				var storeIndex = e.target.dataset.storeIndex;
				var goodsIndex = e.target.dataset.goodsIndex;
				var trolleyGoods = that.trolleyGoods;
				var goods = trolleyGoods[storeIndex].goods[goodsIndex];

				if (pos == 1 && value == 0) {
					value = 1;
					pos = 1;
					return {
						value: value,
						cursor: pos
					};
				}

				if (parseInt(value) > parseInt(skuRest)) {
					uni.showToast({
						icon: 'none',
						title: '该商品库存仅剩' + skuRest + '件',
						duration: 2000
					});
					var len = skuRest.toString().length;
					return {
						value: skuRest,
						cursor: len
					};
				} else if (value == '' || parseInt(value) < 1) {
					return {
						value: 1,
						cursor: 1
					};
				} 
				 if(goods.isPurchaseLimit == '1' && (value > goods.eachOrderConvertMaxNumber)) {
						util.tips('您兑换的数量已达上限')
						return {
							value: goods.eachOrderConvertMaxNumber
						}
					} else {
						return {
							value: value
						}
				}
				
			},

			/**
			 * 修改购物车商品数量
			 */
			changeTrolley: function(e) {
				let that = this;
				var storeIndex = e.target.dataset.storeIndex;
				var goodsIndex = e.target.dataset.goodsIndex;
				var value = e.detail.value;
				var trolleyGoods = that.trolleyGoods;
				var goods = trolleyGoods[storeIndex].goods[goodsIndex];

				if (value < 1) {
					uni.showToast({
						icon: 'none',
						title: '不能再少啦',
						duration: 2000
					});
				} else {
					http.post('/shop/setTrolleyGoodsNum', {
							id: goods.id,
							num: value
						},{
							header: {
								"content-type": "application/x-www-form-urlencoded"
							}
						})
						.then((res) => {
							res = res.data
							console.log(res);

							if('516' == res.code){
								if(goods.isPurchaseLimit == '1' && (value > goods.eachOrderConvertMaxNumber)) {
									goods.number = goods.eachOrderConvertMaxNumber
									util.tips(res.msg)
									this.cannotBtn = true
									this.loading = 0
								} else {
									this.cannotBtn = false
								}
							} else if (200 == res.code) {
								var result = res.msg;
								goods.cannotBtn = false

								if ('SUCCESS' === result) {
									goods.number = value;
									that.trolleyGoods = trolleyGoods
									var trolleyGoodsCache = uni.getStorageSync('TROLLEY_GOODS');
									trolleyGoodsCache[goods.id] = goods;
									uni.setStorageSync('TROLLEY_GOODS', trolleyGoodsCache);
									that.trolleyGoodsFlat = trolleyGoodsCache;
									that
										.calculate(); // console.log("after: number = " + that.data.trolleyGoods[indexx].goods[indexy].number);
								} else if ('NOT_ENOUGH' === result) {
									var newNum = res.skuRest;
									uni.showToast({
										icon: 'none',
										title: '商品库存不足，已修改为库存值',
										duration: 2000
									});
									goods.number = newNum;
									that.trolleyGoods = trolleyGoods
									var trolleyGoodsCache = uni.getStorageSync('TROLLEY_GOODS');
									trolleyGoodsCache[goods.id] = goods;
									uni.setStorageSync('TROLLEY_GOODS', trolleyGoodsCache);
									that.trolleyGoodsFlat = trolleyGoodsCache;
									that.calculate();
									console.log('after: number = ' + that.trolleyGoods[indexx].goods[indexy]
										.number);
								}
							}
						});
				}
			},

			/**
			 * 加载商品规格
			 */
			loadGoodsInfo: function(e) {
				var that = this;
				var id = e.currentTarget.dataset.id;
				var goodsId = e.currentTarget.dataset.goodsid;
				var indexx = e.currentTarget.dataset.indexx;
				var indexy = e.currentTarget.dataset.indexy;
				var trolleyGoods = that.trolleyGoods;
				var spec = trolleyGoods[indexx].goods[indexy].spec;
				var selectSpecSku = [];
				http.get('shopTrolley/skuInfo', {
						params: {
							goodsId: goodsId
						}
					})
					.then((res) => {
						res = res.data
						console.log(res, 7788)
						if (200 == res.code) {
							var tempInfo = res.data;
							var goodsSku = tempInfo.goodsSku;
							var specSku = [];
							var selectText = [];
							var selectSpecName = that.selectSpecName;

							if (JSON.stringify(goodsSku) == '{}') {
								//如果规格数组为空，则根据goodsId查询detailId
								http.get('/shopgoods/goodsDetailId', {
										id: goodsId
									})
									.then((res) => {
										res = res.data
										if (200 == res.code) {
											var detailId = res.detailId;
											that.detailId = res.detailId
										}
									});
							} else {
								//规格数组不为空，则将数组重组添加上checked,用来标记是否选中
								var index = 0;
								let specList = spec.match(/<span (.*?)>(.*?)<\/span>/g);
								let specNameList = [];

								for (let i = 0; i < specList.length; i++) {
									let specItem = specList[i];
									let specName = specItem.substring(specItem.indexOf('>') + 1, specItem.indexOf(
										'</'));
									specNameList.push(specName.trim());
								}

								for (var item in goodsSku) {
									var str = goodsSku[item];
									var size = [];
									for (var i = 0; i < str.length;) {
										if (specNameList.indexOf(str[i].trim()) > -1) {
											size.push({
												name: str[i],
												checked: true
											});
											selectSpecSku[index++] = i;
											selectText.push({
												spec: item,
												name: str[i]
											});
										} else {
											size.push({
												name: str[i],
												checked: false
											});
										}

										i++;

										if (i == str.length) {
											specSku.push({
												spec: item,
												size: size
											});
											selectSpecName.push('');
										}
									}
								}
							}

							that.goodsInfo = res.data
							that.storeid = tempInfo.store.id
							that.rest = typeof tempInfo.rest == 'undefined' ? 0 : tempInfo.rest
							that.specSku = specSku
							that.selectText = selectText
							that.selectSpecSku = selectSpecSku
							that.currentId = id
							that.specInfoShow = true
							that.getGoodsDetail();
						}
					})
					.catch((err) => {
						console.log(err);
						that.loading = -1
					});
			},

			/**
			 * 关闭弹框
			 */
			closeShadow: function() {
				var that = this;
				that.specInfoShow = false
				that.couponShow = false
				that.payContentShow = false
			},

			/**
			 * 展示选择规格
			 */
			goSpecInfo: function(e) {
				var that = this;
				that.specInfoShow = true
			},

			/**
			 * 隐藏选择规格
			 */
			closeSpecInfo: function(e) {
				var that = this;
				that.specInfoShow = false
			},

			/**
			 * 隐藏优惠券
			 */
			closeCoupons: function(e) {
				var that = this;
				that.couponShow = false
			},

			/**
			 * 隐藏去结算弹框
			 */
			closePayContent: function() {
				var that = this;
				that.payContentShow = false
			},

			/**
			 * 选中规格
			 */
			radio: function(spec1, index1) {
				var that = this;
				var index = index1; //获取当前点击的下标

				var spec = spec1; //规格组名称,例：颜色、尺寸

				var specSku = that
					.specSku; //规格选项集合,例[{spec:颜色,size:[{name:红色,checked:false},{name:原谅色,checked:false}],{spec:尺寸,size:{name:大号,checked:false}}]

				var selectSpecSku = that.selectSpecSku; //已经选择了的规格的index数组，例：[0,0]表示选中：红色、大号，[1,0],表示选中：原谅色、大号

				var selectText = that.selectText;
				var selectSpecName = that.selectSpecName;
				var isAllSelected = that.isAllSelected;
				var goodsSpec = []; //存放进行选择操作之后的规格选项集合，记录checked状态
				//每次选规格时将选择的购买数量重置

				that.num = 1

				for (var i = 0; i < specSku.length; i++) {
					var checkboxArr = []; //遍历规格数组，当等于当前选择的规格组时，进入方法

					if (specSku[i].spec == spec) {
						checkboxArr = specSku[i].size; //选项集合，例：size:[{name:红色,checked:false},{name:原谅色,checked:false}]

						var tempCheck = checkboxArr[index].checked; //tempCheck为当前点击的规格选择状态
						//因为当个规格只能选择一项，先将所有所有选择状态置为false

						checkboxArr.forEach((item) => {
							item.checked = false;
						}); //将刚才点击的规格的选择状态取反，如果之前是选中，则变为取消选中

						checkboxArr[index].checked = !tempCheck;

						if (checkboxArr[index].checked) {
							//如果为选中状态，则记录该规格的index值
							selectSpecSku[i] = index;
							that.selectSpecSku = selectSpecSku
							selectText[i].name = checkboxArr[index].name;
							selectSpecName[i] = checkboxArr[index].name;
							console.log(selectText); //当记录已选择规格的数组长度等于 规格数组长度

							if (selectSpecSku.length == specSku.length) {
								//如果不包含标记值 *dex*，表示规格已经选择好了
								if (selectSpecSku.indexOf('*del*') < 0) {
									that.getGoodsDetail();
									console.log('规格选好了');
								}
							}
						} else {
							selectText[i].name = '';
							selectSpecName[i] = ''; //如果是取消选中，则插入标记值 *del*

							selectSpecSku[i] = '*del*'; //之前可能已经查询到了goodsDetailInfo和detailId，将其置为null

							that.selectSpecSku = selectSpecSku
							that.goodsDetailInfo = null
							that.rest = that.goodsInfo.rest
							that.detailId = null
						}
					} //checkboxArr.length == 0 表示没有进入上面的if判断，则specSku[i].size没有变，直接插入

					goodsSpec.push({
						spec: specSku[i].spec,
						size: checkboxArr.length == 0 ? specSku[i].size : checkboxArr
					});
				}

				if (selectSpecName.indexOf('') < 0) {
					isAllSelected = 1;
				} else {
					isAllSelected = 0;
				}

				that.specSku = goodsSpec
				that.selectText = selectText
				that.selectSpecName = selectSpecName
				that.isAllSelected = isAllSelected
				console.log(selectText);
			},

			radioChange: function(e) {},

			/**
			 * 当规格数组不为空时，根据规格查询商品详情
			 */
			getGoodsDetail: function() {
				var that = this;
				var selectSpecSku = that.selectSpecSku;
				var goodsId = that.goodsId;
				var arrPosition = ''; //拼接选中的规格index值，例：0-1，1-1

				selectSpecSku.forEach((item) => {
					arrPosition += item + '-';
				});
				arrPosition = arrPosition.substring(0, arrPosition.length -
					1); //var goodsSkuDetailList = that.data.goodsInfo.skuArray;
				//var goodsDetailInfo = goodsSkuDetailList[arrPosition];

				var goodsDetailInfo = that.getSkuByPosition(arrPosition);
				var rest = goodsDetailInfo.rest;

				if (rest == '' || isNaN(rest) || rest == '0' || rest == '0.00' || rest == undefined) {
					rest = 0;
				}

				that.goodsDetailInfo = goodsDetailInfo
				that.detailId = goodsDetailInfo.detailId
				that.rest = rest
			},

			/**
			 * 更新购物车内商品的规格
			 */
			updateGoodsSpec: function(e) {
				var that = this;
				var id = that.currentId;
				var detailId = that.detailId;
				http.post('/shopTrolley/updateTrolleyGoodsSpec', {
						id: id,
						detailId: detailId
					}, {
						header: {
							"content-type": "application/x-www-form-urlencoded"
						}
					})
					.then((res) => {
						res = res.data
						console.log(res);

						if (200 == res.code) {
							var result = res.msg;

							if ('SUCCESS' === result) {
								that.specInfoShow = false
								that.renderTrolley(res.stores); // that.getTrolley();
								// that.calculate();
							}
						}
					});
			},

			/**
			 * 获取当前店铺拥有的优惠券
			 */
			getCouponsList: function(e) {
				var that = this;
				var couponText = that.couponText;
				var stroeid = e.currentTarget.dataset.stroeid;
				uni.showLoading({
					title: '加载中'
				});
				http.get('shopcoupons/couponCenter', {
						params: {
							storeid: stroeid,
							oauthType: 'merchant'
						}
					})
					.then((res) => {
						res = res.data
						if (200 == res.code) {
							var couponsTemp = res.data;
							var coupons = [];

							for (var i = 0; i < couponsTemp.length; i++) {
								//过滤余量为0的和已过期的优惠券
								if (couponsTemp[i].rest > 0 && couponsTemp[i].outdate == 1) {
									couponsTemp[i].ifShowDetail = false;
									coupons.push(couponsTemp[i]);
								}
							}

							for (var i = 0; i < coupons.length; i++) {
								var couponMessageTemp = {};
								if (coupons[i].money) {
									coupons[i].fontSize = '42rpx'
									coupons[i].money = coupons[i].money + ''
									if(coupons[i].money.length > 5){ coupons[i].fontSize = '36rpx' }
									if(coupons[i].money.length > 6){ coupons[i].fontSize = '32rpx' }
								}

								if (coupons[i].noEffTimes == 'yes') {
									couponMessageTemp.text = '领券次数已用完';
									couponMessageTemp.background = '#B8B8B8';
									couponMessageTemp.bindtap = '';
								} else if (coupons[i].noPerTimes != 'No') {
									if (coupons[i].noPerTimes == 1 || coupons[i].noPerTimes == 0) {
										couponMessageTemp.text = '明天可领取';
										couponMessageTemp.background = '#B8B8B8';
										couponMessageTemp.bindtap = '';
									} else if (coupons[i].noPerTimes == 2) {
										couponMessageTemp.text = '后天可领取';
										couponMessageTemp.background = '#B8B8B8';
										couponMessageTemp.bindtap = '';
									} else {
										couponMessageTemp.text = coupons[i].noPerTimes + '天后可领取';
										couponMessageTemp.background = '#B8B8B8';
										couponMessageTemp.bindtap = '';
									}
								} else {
									couponMessageTemp.text = '领取';
									couponMessageTemp.background = '#9399FF';
									couponMessageTemp.bindtap = 'getCoupon';
								}

								couponText[i] = couponMessageTemp;
							}

							uni.hideLoading();
							that.specInfoShow = false
							that.couponShow = true
							that.coupons = coupons
							that.couponText = couponText
							that.loading = 0
						}
					})
					.catch((err) => {
						that.loading = -1
						uni.hideLoading();
						that.refreshing = false;
						uni.stopPullDownRefresh();
					});
			},

			// 查看优惠券规则详情
			showCouponDesc: function(e) {
				var index = e.currentTarget.dataset.index;
				var coupons = this.coupons;
				coupons[index].ifShowDetail = !coupons[index].ifShowDetail;
				this.coupons = coupons
			},

			/**
			 * 领取优惠券
			 */
			getCoupon: function(e, id, cardflag, index) {
				// if (e == '') {
				// 	uni.showToast({
				// 		'title':'该优惠券无法领取',
				// 		'icon':'none'
				// 	})
				// 	return
				// }
				var that = this;
				var couponid = id;
				var cardFlag = cardflag;

				if (util.isEmpty(cardFlag)) {
					util.tips('是否开通卡券字段获取异常！');
					return;
				}

				var index = index;
				var choseCoupon = that.choseCoupon;
				var couponText = that.couponText;
				var coupons = that.coupons;
				this.$checkAuth().then((res) => {
					if ('0' === cardFlag) {
						http.post('shop/getCoupon', {
								couponid: couponid
							}, {
								header: {
									"content-type": "application/x-www-form-urlencoded"
								}
							})
							.then((res) => {
								res = res.data
								if (200 == res.code) {
									if (res.msg == 'SUCCESS' && res.noEffTimes == 'No' && res
										.noLimitTimes == 'No') {
										uni.showToast({
											title: '领取成功'
										});
									} else if (res.msg == 'SUCCESS' && res.noEffTimes == 'Yes') {
										uni.showToast({
											title: '领取成功'
										});
										couponText[index].text = '领券次数用完';
										couponText[index].background = '#B8B8B8';
										couponText[index].bindtap = '';
									} else if (res.msg == 'SUCCESS' && res.noEffTimes == 'No' && res
										.noLimitTimes != 'No') {
										uni.showToast({
											title: '领取成功'
										});

										if (res.noLimitTimes == '1' || res.noLimitTimes == '0') {
											couponText[index].text = '明天可领取';
										} else if (res.noLimitTimes == '2') {
											couponText[index].text = '后天可领取';
										} else {
											couponText[index].text = res.noLimitTimes + '天后可领取';
										}

										couponText[index].background = '#B8B8B8';
										couponText[index].bindtap = '';
									} else if (res.msg == 'NO_COUPONS') {
										uni.showToast({
											title: '很抱歉，该优惠券已领完！',
											icon:'none'
										});
										couponText[index].text = '已领完';
										couponText[index].background = '#B8B8B8';
										couponText[index].bindtap = '';
									} else if (res.msg == 'NO_EFFLIMIT_TIMES') {
										uni.showToast({
											title: '很抱歉，领券次数用完！',
											icon:'none'
										});
										couponText[index].text = '领券次数用完';
										couponText[index].background = '#B8B8B8';
										couponText[index].bindtap = '';
									} else if (res.msg == 'NO_PERLIMIT_TIMES') {
										uni.showToast({
											title: '很抱歉，周期内领取已达上线',
											icon:'none'
										});

										if (res.day == 1 || res.day == 0) {
											couponText[index].text = '明天可领取';
										} else if (res.day == 2) {
											couponText[index].text = '后天可领取';
										} else {
											couponText[index].text = res.day + '天后可领取';
										}

										couponText[index].background = '#B8B8B8';
										couponText[index].bindtap = '';
									}

									choseCoupon[index] = couponid;
									that.choseCoupon = choseCoupon
									that.couponText = couponText
									that.coupons = coupons
								}
							});
					} else if ('1' === cardFlag) {
						//先调用微信接口获取微信随机分配的code（先判断该用户是否领过卡券），用户领取成功后再更新我们系统的券码
						http.get('shop/hasCoupon', {
							params:{
								couponId: couponid
							}
						})
							.then((res) => {
								res = res.data
								let flag = res.flag;

								if (util.isEmpty(flag)) {
									uni.showToast({
										title: '参数异常',
										icon: 'none',
										duration: 2000
									});
									return;
								} // if ("1" == flag) {
								//   wx.showToast({
								//     title: '已经领取过该优惠券，不能重复领取',
								//     icon: 'none',
								//     duration: 2000
								//   })
								//   return;
								// } else if ("0" == flag) {
								//调用微信卡券接口获取导入的一张code,先获取签名参数

								http.get('member/getCouponParam', {
									params:{
										couponId: couponid
									}
								})
									.then((res1) => {
										res1 = res1.data
										let code = res1.code;

										if (200 !== code) {
											util.tips('获取微信参数异常！');
											return;
										} else {
											uni.addCard({
												cardList: [{
													cardId: res1.cardId,
													cardExt: '{"outer_str":"miniProgram","timestamp":"' +
														res1.timestamp +
														'","nonce_str":"' +
														res1.nonceStr +
														'","signature":"' +
														res1.signature +
														'"}'
												}],
												// 需要添加的卡券列表
												success: function(res2) {
													let cardList = res2.cardList;
													console.log('cardList-----' +
														cardList);
													let obj = cardList[0];
													console.log('obj-----' + obj);
													let encryptCode = obj.code;
													console.log('encryptCode-----' +
														encryptCode);
													let cardId = obj.cardId;
													console.log('cardId-----' +
														cardId
													); //通过获取的code从我们数据库中找出对应的code并更新用户信息

													http.post('shop/getCouponNew', {
															couponid: couponid,
															encryptCode: encryptCode,
															cardId: cardId
														})
														.then((res3) => {
															res3 = res3.data
															if (200 == res3.code) {
																if (res3.msg ==
																	'SUCCESS' &&
																	res3
																	.noEffTimes ==
																	'No' && res3
																	.noLimitTimes ==
																	'No') {
																	uni.showToast({
																		title: '领取成功'
																	});
																} else if (res3
																	.msg ==
																	'SUCCESS' &&
																	res3
																	.noEffTimes ==
																	'Yes') {
																	uni.showToast({
																		title: '领取成功'
																	});
																	couponText[
																			index]
																		.text =
																		'领券次数用完';
																	couponText[
																			index]
																		.background =
																		'#B8B8B8';
																	couponText[
																			index]
																		.bindtap =
																		'';
																} else if (res3
																	.msg ==
																	'SUCCESS' &&
																	res3
																	.noEffTimes ==
																	'No' && res3
																	.noLimitTimes !=
																	'No') {
																	uni.showToast({
																		title: '领取成功'
																	});

																	if (res3
																		.noLimitTimes ==
																		'1' || res3
																		.noLimitTimes ==
																		'0') {
																		couponText[
																				index
																			]
																			.text =
																			'明天可领取';
																	} else if (res3
																		.noLimitTimes ==
																		'2') {
																		couponText[
																				index
																			]
																			.text =
																			'后天可领取';
																	} else {
																		couponText[
																				index
																			]
																			.text =
																			res3
																			.noLimitTimes +
																			'天后可领取';
																	}

																	couponText[
																			index]
																		.background =
																		'#B8B8B8';
																	couponText[
																			index]
																		.bindtap =
																		'';
																} else if (res3
																	.msg ==
																	'NO_COUPONS') {
																	uni.showToast({
																		icon:'none',
																		title: '很抱歉，该优惠券已领完！'
																	});
																	couponText[
																			index]
																		.text =
																		'已领完';
																	couponText[
																			index]
																		.background =
																		'#B8B8B8';
																	couponText[
																			index]
																		.bindtap =
																		'';
																} else if (res3
																	.msg ==
																	'NO_EFFLIMIT_TIMES'
																) {
																	uni.showToast({
																		icon:'none',
																		title: '很抱歉，领券次数用完！'
																	});
																	couponText[
																			index]
																		.text =
																		'领券次数用完';
																	couponText[
																			index]
																		.background =
																		'#B8B8B8';
																	couponText[
																			index]
																		.bindtap =
																		'';
																} else if (res3
																	.msg ==
																	'NO_PERLIMIT_TIMES'
																) {
																	uni.showToast({
																		icon:'none',
																		title: '很抱歉，周期内领取已达上线'
																	});

																	if (res3.day ==
																		1 || res3
																		.day == 0
																	) {
																		couponText[
																				index
																			]
																			.text =
																			'明天可领取';
																	} else if (res3
																		.day == 2
																	) {
																		couponText[
																				index
																			]
																			.text =
																			'后天可领取';
																	} else {
																		couponText[
																				index
																			]
																			.text =
																			res3
																			.day +
																			'天后可领取';
																	}

																	couponText[
																			index]
																		.background =
																		'#B8B8B8';
																	couponText[
																			index]
																		.bindtap =
																		'';
																}

																choseCoupon[
																		index] =
																	couponid;
																that.choseCoupon =
																	choseCoupon
																that.couponText =
																	couponText
																that.coupons =
																	coupons
															}
														});
												}
											});
										}
									}); // }
							});
					}

				});
			},

			//阻止背景滚动
			preventTouchMove: function(e) {},

			getSkuByPosition: function(position) {
				var goodsSkuDetailList = this.goodsInfo.skuArray;
				var sku = {};

				for (var i = 0; i < goodsSkuDetailList.length; i++) {
					if (position == goodsSkuDetailList[i].skuPosition) {
						sku = goodsSkuDetailList[i];
						break;
					}
				}

				return sku;
			},

			trueFun() {
				console.log('占位：函数 true 未声明');
			}
		}
	};
</script>
<style>
	/* @import '../../iconfont/iconfont.css'; */
	/* pages/cart/cart.wxss */

	.body {
		overflow-x: hidden;
		font-size: 24rpx;
		padding-top: 24rpx;
		padding-bottom: 182rpx;
		background: #fff;
		height: 100vh;
	}

	/*隐藏滚动条*/

	::-webkit-scrollbar {
		width: 0;
		height: 0;
		color: transparent;
	}

	.msg {
		text-align: center;
		font-size: 30rpx;
		color: #aaa;
		padding-top: 200rpx;
		padding-bottom: 100rpx;
	}

	.icon {
		font-size: 100rpx;
	}

	.p-title {
		margin-top: 100rpx;
		margin-bottom: 20rpx;
		text-align: center;
		font-size: 32rpx;
	}

	.p-title-line {
		width: 50rpx;
		bottom: 10rpx;
		position: relative;
		border-bottom: 2rpx solid;
		display: inline-block;
	}

	.p-title-content {
		margin: 0 20rpx;
	}

	.likeGoods {
		width: 750rpx;
		border-top: 2rpx #eee solid;
		overflow: auto;
	}

	.likeGoods-item {
		width: 250rpx;
		font-size: 24rpx;
		float: left;
		overflow: auto;
		background: #fff;
		border-right: 2rpx #eee solid;
		border-bottom: 2rpx #eee solid;
		box-sizing: border-box;
	}

	.likeGoods-item-image {
		width: 210rpx;
		height: 210rpx;
		margin: 20rpx;
		display: block;
	}

	.likeGoods-item-info {
		padding: 20rpx;
		position: relative;
		text-align: left;
	}

	.likeGoods-item-name {
		height: 30rpx;
		overflow: hidden;
		font-size: 24rpx;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.likeGoods-item-price {
		height: 80rpx;
		line-height: 40rpx;
		margin-top: 10rpx;
		white-space: nowrap;
		display: flex;
		flex-direction: column;
		justify-content: center;
	}

	.likeGoods-item-price-norm {
		height: 40rpx;
		line-height: 40rpx;
		font-size: 30rpx;
		font-weight: bold;
		display: block;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.likeGoods-item-price-vip {
		height: 40rpx;
		line-height: 40rpx;
		font-size: 24rpx;
		background: #444;
		color: yellow;
		text-align: center;
		border-radius: 20rpx;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.edit-area {
		position: fixed;
		top: 0;
		font-size: 30rpx;
		width: 750rpx;
		height: 80rpx;
		line-height: 80rpx;
		background-color: white;
		z-index: 2;
	}

	.edit-btn {
		margin-right: 40rpx;
		float: right;
	}

	.stores {
		width: 750rpx;
		margin-bottom: 200rpx;
		padding: 0 18rpx 0 20rpx;
	}

	.store-item {
		margin-bottom: 30rpx;
		box-shadow: 0px 20rpx 60rpx 0px rgba(112, 136, 210, 0.1);
		border-radius: 16rpx;
		overflow: hidden;
	}

	.store-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding-right: 26rpx;
		width: 712rpx;
		height: 96rpx;
		font-size: 28rpx;
		background: #fff;
		border-bottom: 1px solid #f4f4f4;
	}

	.store-Info {
		display: flex;
		align-items: center;
	}

	.store-chioce {
		width: 88rpx;
		text-align: center;
		font-size: 42rpx;
		display: inline-block;
	}

	.icon-shangcheng {
		width: 60rpx;
		text-align: center;
		font-size: 36rpx;
		display: inline-block;
	}

	.store-name {
		font-size: 32rpx;
		font-weight: 600;
	}

	.icon-iconfontyoujiantou {
		display: inline-block;
		width: 40rpx;
		text-align: center;
		font-size: 30rpx;
		color: #000;
	}

	.get-coupon-btn {
		font-size: 26rpx;
		color: #333;
	}

	.store-goods {
		width: 712rpx;
		background-color: #f8f8f8;
	}

	.goods {
		display: flex;
		align-items: center;
		width: 100%;
		height: 100%;
		background-color: #fff;
		margin-right: 0;
		-webkit-transition: all 0.4s;
		transition: all 0.4s;
		-webkit-transform: translateX(103rpx);
		transform: translateX(103rpx);
		margin-left: -103rpx;
	}

	.goods-chioce {
		width: 88rpx;
		height: 200rpx;
		line-height: 200rpx;
		font-size: 42rpx;
		text-align: center;
		float: left;
	}

	.icon-null {
		font-size: 46rpx !important;
	}

	.goods-content {
		display: flex;
		height: 100%;
		padding: 30rpx 0;
		border-bottom: 1px solid #f4f4f4;
	}

	.goods-item:last-child .goods-content {
		border-bottom: none;
	}

	.goods-logo {
		width: 200rpx;
		height: 200rpx;
		/* float: left; */
	}

	.goods-image {
		width: 100%;
		height: 100%;
		border-radius: 4rpx;
	}

	.right {
		padding: 0 20rpx;
		width: 450rpx;
		height: 200rpx;
	}

	.goods-name {
		width: 410rpx;
		height: 120rpx;
	}

	.name {
		overflow: hidden;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		height: 72rpx;
		line-height: 36rpx;
		font-size: 30rpx;
	}

	.goods-spec {
		display: inline-block;
		margin-top: 10rpx;
		padding-left: 16rpx;
		max-width: 400rpx;
		height: 40rpx;
		line-height: 40rpx;
		font-size: 24rpx;
		color: #999;
		background-color: rgba(153, 153, 153, 0.1);
		border-radius: 4rpx;
	}

	.spec {
		display: inline-block;
		max-width: 336rpx;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.icon-right1 {
		float: right;
		height: 40rpx;
		width: 32rpx;
		font-size: 24rpx;
		line-height: 40rpx;
	}

	.right-bottom {
		display: flex;
		justify-content: space-between;
		align-items: flex-end;
		width: 410rpx;
		height: 80rpx;
	}

	.goods-price {
		height: 40rpx;
		line-height: 40rpx;
		padding: 0 10rpx;
		font-size: 32rpx;
		display: flex;
		flex-wrap: nowrap;
		align-items: center;
		/* font-weight: bold; */
	}

	.goods-number {
		display: flex;
		align-items: center;
		width: 175rpx;
		font-size: 26rpx;
	}

	.decodeadd {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 44rpx;
		height: 44rpx;
		font-size: 40rpx;
		line-height: 40rpx;
		vertical-align: middle;
		border: 1px solid #e5e5e5;
		border-radius: 2rpx;
	}
	.canNotAdd {
		color: #ccc;
	}

	.goods-number-num {
		width: 64rpx;
		text-align: center;
		border-bottom: 1px solid #e5e5e5;
		border-top: 1px solid #e5e5e5;
		height: 44rpx;
		line-height: 40rpx;
		box-sizing: border-box;
	}

	.icon-delete {
		height: 70rpx;
		line-height: 70rpx;
		font-size: 40rpx;
		color: #fff;
		display: inline-block;
	}

	.support {
		position: relative;
	}

	.calculate {
		width: 750rpx;
		height: 182rpx;
		background-color: white;
		border-top: 2rpx solid #eee;
	}

	.footer {
		position: fixed;
		bottom: 0;
		left: 0;
		display: flex;
		align-items: center;
		justify-content: space-between;
		font-size: 28rpx;
	}

	.fr {
		margin-left: 20rpx;
	}

	.calculate-all {
		width: 160rpx;
		height: 80rpx;
		line-height: 80rpx;
		font-size: 32rpx;
		text-align: right;
		color: #333;
		float: left;
	}

	.calculate-money {
		font-size: 36rpx;
		padding: 0 20rpx 0 10rpx;
		/* font-weight: bold; */
	}

	.calculate-num {
		width: 100rpx;
		height: 100rpx;
		line-height: 100rpx;
		font-size: 26rpx;
		text-align: center;
		float: left;
	}

	.calculate-order {
		width: 180rpx;
		height: 78rpx;
		/* box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(228, 169, 169, 0.5); */
		border-radius: 39px;
		line-height: 78rpx;
		font-size: 34rpx;
		text-align: center;
		color: #fff;
	}

	/* 滑动出来的删除按钮 */

	.goods-item {
		display: flex;
		widows: 100%;
		height: 260rpx;
		background-color: #fff;
	}

	.goods-item:last-child {
		border-bottom: none;
	}

	.del {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		width: 110rpx;
		color: #fff;
		-webkit-transform: translateX(110rpx);
		transform: translateX(110rpx);
		-webkit-transition: all 0.4s;
		transition: all 0.4s;
		background-color: #c00;
	}

	.touch-move-active .goods,
	.touch-move-active .del {
		-webkit-transform: translateX(0);
		transform: translateX(0);
	}

	/* 规格信息弹出框 */

	.shadow-bg {
		position: fixed;
		left: 0;
		top: 0;
		display: flex;
		flex-direction: column;
		width: 100%;
		height: 100%;
		background-color: rgba(12, 12, 12, 0.5);
		z-index: 100;
	}

	.spec-info {
		position: relative;
		width: 100%;
		height: 850rpx;
		background-color: #fff;
		box-sizing: border-box;
		border-radius: 50rpx 50rpx 0 0;
	}

	.spec-info::-webkit-scrollbar {
		width: 0;
		height: 0;
		color: transparent;
	}

	.spec-header {
		display: flex;
		justify-content: center;
		height: 54rpx;
		width: 100%;
		padding-top: 30rpx;
	}

	.spec-line {
		width: 56rpx;
		height: 8rpx;
		background: #d8d8d8;
		border-radius: 7rpx;
	}

	.spec-title {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 0 20rpx;
		height: 100rpx;
		font-size: 26rpx;
	}

	.spec-goods {
		display: flex;
		margin-bottom: 40rpx;
		padding: 0 34rpx;
	}

	.spec-goods-img {
		width: 196rpx;
		height: 196rpx;
		border-radius: 4rpx;
	}

	.spec-goods-info {
		display: flex;
		flex-direction: column;
		justify-content: center;
		padding: 0 30rpx;
		width: 486rpx;
		line-height: 50rpx;
		font-size: 26rpx;
	}

	.spec-goods-price {
		font-size: 32rpx;
	}

	.spec-vip-price {
		width: 200rpx;
		line-height: 40rpx;
		color: yellow;
		font-size: 24rpx;
		text-align: center;
		background: #444;
		border-radius: 20rpx;
	}

	.sepc-content {
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		padding: 0 36rpx;
	}

	.spec-content-title {
		font-size: 28rpx;
		font-weight: 500;
		color: #03081a;
		line-height: 40rpx;
	}

	.spec-box {
		display: flex;
		flex-wrap: wrap;
		margin-top: 20rpx;
	}

	.check-content {
		display: flex;
		flex-wrap: wrap;
		margin-left: -10rpx;
		padding: 32rpx 0 20rpx;
	}

	.checkbox {
		margin-bottom: 40rpx;
		margin-right: 50rpx;
		padding: 8rpx 32rpx;
		text-align: center;
		font-size: 28rpx;
		color: #555;
		background-color: #eee;
		border-radius: 28rpx;
	}

	.checked {
		color: #fff !important;
	}

	.checkbox checkbox {
		display: none;
	}

	.select-num {
		display: flex;
		align-items: center;
		padding: 20rpx;
		height: 80rpx;
		font-size: 30rpx;
	}

	.select-num .iconfont {
		height: 50rpx;
		font-size: 50rpx;
	}

	.btns {
		position: absolute;
		left: 16rpx;
		bottom: 40rpx;
		display: flex;
		align-items: center;
		width: 718rpx;
		height: 80rpx;
		z-index: 102;
	}

	.btns button {
		width: 100% !important;
		height: 80rpx;
		line-height: 80rpx;
		font-size: 32rpx;
		border: none;
		border-radius: 44rpx;
		padding: 0 !important;
	}

	.slideUp {
		animation: slideUp 0.15s 1 linear alternate;
	}

	@keyframes slideUp {
		from {
			bottom: -870rpx;
		}

		to {
			bottom: 0;
		}
	}

	/* 优惠券列表 */

	.coupon-info {
		position: relative;
		width: 100%;
		height: 900rpx;
		background-color: #fff;
		border-radius: 50rpx 50rpx 0 0;
	}

	.coupon-header {
		position: relative;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		align-items: center;
		padding: 30rpx;
		width: 100%;
		height: 146rpx;
		text-align: center;
		background-color: #fff;
		border-radius: 50rpx 50rpx 0 0;
	}

	.coupon-line {
		width: 56rpx;
		height: 8rpx;
		background: #d8d8d8;
		border-radius: 7rpx;
	}

	.coupon-title {
		font-weight: bold;
		font-size: 32rpx;
		color: #03081a;
		line-height: 44rpx;
	}

	.icon-cuo1 {
		font-size: 36rpx;
		color: #666;
	}

	.coupon-list {
		overflow: auto;
		width: 100%;
		height: 754rpx;
		box-sizing: border-box;
		-webkit-overflow-scrolling: touch;
	}

	.coupon-list::-webkit-scrollbar {
		display: none;
	}

	.coupon-list-item {
		display: flex;
		flex-direction: column;
		margin: 0 24rpx 28rpx;
		background: #fcf7f1;
		border-radius: 15rpx;
	}

	.coupon-list-item-content {
		position: relative;
		display: flex;
		justify-content: space-between;
		width: 702rpx;
		height: 227rpx;
		border-radius: 15rpx;
		color: #fd4c52;
	}

	.item-tag {
		z-index: 100;
		position: absolute;
		width: 126rpx;
		height: 30rpx;
		background: rgba(255, 177, 180, 0.5);
		border-radius: 15rpx 0px 15rpx 0px;
		font-size: 20rpx;
		color: #fd4c52;
		line-height: 28rpx;
		text-align: center;
	}

	.item-left {
		position: relative;
		display: flex;
		width: 522rpx;
		height: 100%;
		font-size: 22rpx;
	}

	.item-discount {
		display: flex;
		flex-direction: column;
		align-items: flex-end;
		width: 158rpx;
		height: 100%;
		padding-top: 44rpx;
		font-size: 26rpx;
		border-radius: 12rpx 0 0 12rpx;
	}

	.price-num {
		font-size: 26rpx;
		margin-right: 10rpx;
	}

	.discount-num {
		font-size: 26rpx;
		margin-right: 10rpx;
	}

	.discount-tip {
		font-size: 22rpx;
		text-align: end;
	}

	.item-detail {
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		/* align-items: center; */
		padding: 40rpx 24rpx 18rpx 24rpx;
		width: 366rpx;
		height: 100%;
		font-size: 22rpx;
	}

	.couponName {
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
		width: 100%;
		font-size: 30rpx;
		line-height: 42rpx;
		font-weight: bold;
	}

	.coupon-price {
		margin-bottom: 10rpx;
		font-size: 60rpx;
		font-weight: bold;
	}

	.rmb {
		font-size: 36rpx;
	}

	.item-right {
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		align-items: flex-end;
		/* width: 180rpx; */
		height: 100%;
		padding: 62rpx 20rpx 16rpx 0;
		font-size: 22rpx;
		border-radius: 0 15rpx 15rpx 0;
	}

	.coupon-btn {
		min-width: 144rpx;
		height: 50rpx;
		line-height: 50rpx;
		text-align: center;
		color: #fff;
		font-size: 24rpx;
		border-radius: 24rpx;
	}

	.coupon-desc-btn {
		display: flex;
		align-items: center;
		justify-content: flex-end;
		width: 144rpx;
		height: 32rpx;
		font-size: 22rpx;
		line-height: 32rpx;
	}

	.arrow-down {
		width: 24rpx;
		height: 12rpx;
		margin-left: 10rpx;
	}

	.coupon-desc-text {
		position: relative;
		width: 702rpx;
		padding: 30rpx 22rpx;
		font-size: 24rpx;
		color: #b3b3b3;
		line-height: 34rpx;
	}

	.coupon-desc-text::before {
		position: absolute;
		content: '';
		top: 0;
		left: 30rpx;
		right: 20rpx;
		height: 2rpx;
		background: #eeeeee;
	}

	.coupon-submit {
		width: 100%;
		height: 100rpx;
		line-height: 100rpx;
		font-size: 30rpx;
		color: #fff;
		border: none;
		border-radius: 0;
	}

	/*点击去结算弹框*/

	.pay-content {
		position: relative;
		width: 100%;
		height: 900rpx;
		background-color: #fff;
	}

	.pay-title-content {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 0 20rpx;
		width: 100%;
		height: 90rpx;
		font-size: 26rpx;
		color: #333;
		border-bottom: 1px solid #f4f4f4;
	}

	.pay-warning {
		padding-left: 20rpx;
		height: 100rpx;
		line-height: 100rpx;
		font-size: 24rpx;
		color: #999;
	}

	.pay-list {
		overflow: scroll;
		height: 700rpx;
	}

	.pay-item {
		padding: 30rpx 20rpx;
		border-bottom: 1px solid #f4f4f4;
	}

	.pay-item:first-child {
		padding-top: 0;
	}

	.pay-item-title {
		margin-bottom: 30rpx;
		font-size: 26rpx;
		font-weight: bold;
	}

	.total-goods {
		font-size: 24rpx;
		font-weight: normal;
		color: #999;
	}

	.pay-goods {
		display: flex;
		justify-content: space-between;
		align-items: flex-end;
		padding-bottom: 30rpx;
	}

	.pay-goods-list {
		display: flex;
		flex-wrap: wrap;
		width: 590rpx;
	}

	.pay-goods-item {
		margin-top: 10rpx;
		margin-right: 10rpx;
		width: 170rpx;
		height: 170rpx;
		background-color: #ccc;
		border-radius: 2rpx;
	}

	.pay-goods-item:nth-child(3n) {
		margin-right: 0;
	}

	.pay-goods-item image {
		width: 100%;
		height: 100%;
	}

	.pay-btn {
		width: 160rpx;
		height: 60rpx;
		line-height: 60rpx;
		text-align: center;
		color: #fff;
		background-color: #ff464a;
		border-radius: 5rpx;
		font-size: 28rpx;
	}

	.vip-block {
		position: absolute;
		bottom: 0;
		background-image: linear-gradient(90deg, #811dbb, #9a198f, #8002aa);
		width: 200rpx;
		height: 0.9rem;
		opacity: 1;
	}

	.vip-prices {
		font-size: 0.5rem;
		color: white;
		text-align: center;
		vertical-align: middle;
		height: 0.9rem;
		display: flex;
		flex-wrap: nowarp;
		justify-content: center;
		align-items: center;
	}

	.vip-jias {
		background: white;
		border-radius: 0.2rem;
		width: fit-content;
		padding: 0 0.1rem;
		margin-left: 0.3rem;
		font-size: 0.4rem;
		float: right;
		color: #811dbb;
		height: 0.6rem;
	}

	.discount-title {
		font-size: 12px;
		bottom: 0;
	}

	.vip_icon {
		height: 24rpx;
		width: 52rpx;
		margin-left: 10rpx;
	}

	.spec-goods-price .num {
		display: inline-flex !important;
	}
</style>
